#!/usr/bin/python
# -*- coding: utf-8 -*-

def xencoder(x,bit,start=-180.0,end=180.0):
        if bit==0:
            return '1'

        mid=(start+end)/2
        if x>=start and x<=mid:
            arrx.append('0')
            xencoder(x,bit-1,start,mid)


        if x>mid and x<=end:
            arrx.append('1')
            xencoder(x, bit-1, mid, end)

        return arrx


def yencoder(x, bit, start=-90.0, end=90.0):
    if bit == 0:
        return '1'

    mid = (start + end) / 2
    if x >= start and x <= mid:
        arry.append('0')
        yencoder(x, bit - 1, start, mid)

    if x > mid and x <= end:
        arry.append('1')
        yencoder(x, bit - 1, mid, end)

    return arry

def tencoder(x, bit, start = 0.0, end = 7*24*3600.000):
    if bit == 0:
        return '1'

    mid = (start + end) / 2
    if x >= start and x <= mid:
        arrt.append('0')
        tencoder(x, bit - 1, start, mid)

    if x > mid and x <= end:
        arrt.append('1')
        tencoder(x, bit - 1, mid, end)

    return arrt

def bin2int(s):
    return ''.join([chr(i) for i in [int(b,2) for b in s.split(' ')]])

x=float(input())
y=float(input())
t=float(input())
bitxy=input()
bitt=input()


arrx = []
arry = []
arrt = []
stackx = xencoder(x,bitxy)
stacky= yencoder(y,bitxy)
stackt= tencoder(t,bitt,0.0)#,525600.0)
print stackx
print stacky
print stackt
print int("".join(stackx),2)
print int("".join(stacky),2)
print int("".join(stackt),2)


zippxyt =  zip(stackx,stacky,stackt)
print zippxyt
bitxyt=''
for i in range(0,bitxy):
    for j in range(0,3):
        bitxyt=bitxyt+zippxyt[i][j]

print  bitxyt
print int("".join(bitxyt),2)